/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.fasepa.sgpf.rn;

import br.gov.fasepa.sgpf.dao.ServidorDAO;
import br.gov.fasepa.sgpf.entity.Cargo;
import br.gov.fasepa.sgpf.entity.Servidor;
import br.gov.fasepa.sgpf.entity.TipoCargo;
import br.gov.fasepa.sgpf.factoryDAO.GenericRN;
import java.util.List;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.authentication.encoding.PasswordEncoder;

/**
 *
 * @author marcosdj
 */
public class ServidorRN extends GenericRN<Servidor> {

    public Servidor obtain(String matricula) {
        return new ServidorDAO().obter(matricula);
    }
    
    public Servidor obterporEmail(String email){
       return new ServidorDAO().obterPorEmail(email);
    }

    public List<Servidor> listaDecrescente() {
        return new ServidorDAO().ListarDecrescente();
    }

    public List<Servidor> listaComFiltro(Cargo c, TipoCargo t) {
        return new ServidorDAO().ListarServidorFiltro(c, t);
    }

    public String encriptarSenha(String senha) {
        PasswordEncoder encoder = new Md5PasswordEncoder();
        senha = encoder.encodePassword(senha, null);
        return senha;
    }
       
}
